package main

import (
	"fmt"
	"strconv"
)

//字符串的压缩， “aaabbcaaddd”  -->a3b2c1a2d3

func main() {
	var str string
	str2 := ""
	fmt.Println("请输入一个字符串：")
	fmt.Scan(&str)
	count := 1
	for i := 1; i < len(str); i++ {
		if str[i] == str[i-1] {
			count++
		} else {
			s := strconv.Itoa(count)
			str2 += string(str[i-1]) + string(s)
			count = 1
		}
	}
	s := strconv.Itoa(count)
	str2 += string(str[len(str)-1]) + string(s)
	fmt.Println(str2)
}


